/**
 * 
 */
package entities;

import java.io.Serializable;

import common.MyFile;

/**
 *@author Juan Alapin - 324507516
 *@author Giora Yaffe - 036551281
 *@author Shachar Gritzman - 300174026
 *@author Nir Porat - 021515580
*/

public class CProcessRequest implements Serializable
{
	/**
	 * The Process Details
	 * @param requestID - request ID.
	 * @param selectedSystem - The System That The Process Is About.
	 * @param currentDescription - Current State Description.
	 * @param changeDescription - Requested Change Description.
	 * @param reason - Reason For Change (Or Benefit).
	 * @param comments - comments for request.
	 * @param Cprocess - The process that connected to the request
	 */
	private static final long serialVersionUID = 1L;
	private int requestInitiatorID;
	private int requestID;
	private String selectedSystem;
	private String currentDescription;
	private String changeDescription;
	private String reason;
	private String comments;
	private MyFile reqFile;
	private int fileFlag;
	private String fileEnd;
	
	/**
	 * Constructor For Process (Without A File) That All Ready Has Been Created
	 * @param reqID - request's ID
	 * @param initiatorID - Initiator's ID
	 * @param selectedSys - The System That The Process Is About.
	 * @param curDesc - Current State Description.
	 * @param changeDesc - Requested Change Description.
	 * @param reas - Reason For Change (Or Benefit).
	 */
	public CProcessRequest (int reqID,int initiatorID,String selectedSys,String curDesc,String changeDesc,String reas)
	{
	this(reqID,initiatorID,selectedSys,curDesc,changeDesc,reas,"");
	}	
	
	/**
	 * Constructor For Process (With A File) That All Ready Has Been Created
	 * @param reqID - request's ID
	 * @param initiatorID - Initiator's ID
	 * @param selectedSys - The System That The Process Is About.
	 * @param curDesc - Current State Description.
	 * @param changeDesc - Requested Change Description.
	 * @param reas - Reason For Change (Or Benefit).
	 * @param comment - comments for request.
	 */
	public CProcessRequest (int reqID,int initiatorID,String selectedSys,String curDesc,String changeDesc,String reas,String comment)
	{
	requestID = reqID;
	setRequestInitiatorID(initiatorID);
	selectedSystem = new String (selectedSys);
	currentDescription = new String (curDesc);
	changeDescription = new String (changeDesc);
	reason = new String (reas);
	comments = new String(comment);
	fileFlag=0;
	}
	
	/**
	 * Constructor For A New Process Without A File - The Process Id Will Be Initialized By 0 And Will BE Generated In The DB
	 * @param initiatorID - Initiator's ID
	 * @param selectedSys - The System That The Process Is About.
	 * @param curDesc - Current State Description.
	 * @param changeDesc - Requested Change Description.
	 * @param reas - Reason For Change (Or Benefit).
	 */
	public CProcessRequest(int initiatorID,String selectedSys,String curDesc,String changeDesc,String reas)
	{
		this(initiatorID,selectedSys,curDesc,changeDesc,reas,"");	
	}
	
	/**
	 * Constructor For A New Process With A File - The Process Id Will Be Initialized By 0 And Will BE Generated In The DB
	 * @param initiatorID - Initiator's ID
	 * @param selectedSys - The System That The Process Is About.
	 * @param curDesc - Current State Description.
	 * @param changeDesc - Requested Change Description.
	 * @param reas - Reason For Change (Or Benefit).
	 * @param comment - comments for request.
	 */
	public CProcessRequest(int initiatorID,String selectedSys,String curDesc,String changeDesc,String reas,String comment)
	{
	requestID = 0;
	setRequestInitiatorID(initiatorID);
	selectedSystem = new String (selectedSys);
	currentDescription = new String (curDesc);
	changeDescription = new String (changeDesc);
	reason = new String (reas);
	comments = new String(comment);
	fileFlag=0;
	}
	
	/**
	 * returns the file end of the file that is attached to the request
	 * @return
	 */
	public String getFileEnd(){
		if(this.fileFlag==1)return(fileEnd);
		else return("");
	}
	
	/**
	 * returns the file that is attached to the request
	 * @return MyFile
	 */
	public MyFile getReqFile(){
		if(this.fileFlag==1)return(reqFile);
		else return(null);
	}
	
	/**
	 * add file to request set flag to insure that
	 * @param fileEnd 
	 * @param file:MyFile
	 */
	public void setFile(MyFile file, String sfileEnd){
		reqFile=file;
		fileFlag=1;
		fileEnd = new String(sfileEnd);
	}
	
	/**
	 * returns the flag that says if the request has an attachment
	 * @return
	 */
	public int getFileFlag(){
		return(this.fileFlag);
	}
	
	/**
	 * Getter - requestID
	 * returns the request's ID
	 */
	public int getrequestID()
	{
		return(requestID);
	}
	
	/**
	 * Getter - Initiator ID
	 * returns the request's Initiator ID
	 */
	public int getinitatorID()
	{
		return(requestInitiatorID);
	}
	
	
	/**
	 * Getter - selectedSystem
	 * returns the request's selected system for change
	 */
	public String getselectedSystem()
	{
		return(selectedSystem);
	}	
	
	/**
	 * Getter - currentDesc
	 * returns the description of current state in the selected system 
	 */
	public String getcurrentDescription()
	{
		return(currentDescription);
	}
	
	/**
	 * Getter - changeDesc
	 * returns the description of the wanted change in the selected system
	 */
	public String getchangeDescription()
	{
		return(changeDescription);
	}
	
	/**
	 * Getter - reason
	 * returns the reason for the request
	 */
	public String getreason()
	{
		return(reason);
	}
	
	/**
	 * Getter - comments
	 * returns the comments for the request
	 */
	public String getcomments()
	{
		return(comments);
	}
	
	/**
	 * Getter - RequestInitiatorID
	 * returns the comments for the request
	 */
	public int getRequestInitiatorID() {
		return requestInitiatorID;
	}
	/**
	 * Setter - RequestInitiatorID
	 * set the reqsuest's Initiator ID
	 */
	public void setRequestInitiatorID(int requestInitiatorID) {
		this.requestInitiatorID = requestInitiatorID;
	}
	
}
	